package com.student.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.student.pojo.Classes;
import com.student.pojo.Ke;
import com.student.service.ClassKeService;
import com.student.service.ClassesService;
import com.student.service.KeService;
import com.student.utils.JsonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpRequest;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
/**
 * @author 是一个鸽子啊
 * @date 2020/4/14
 * @qq 364826415
 */
@RestController
public class classKeAjaxController {
    @Autowired
    @Qualifier("KeServiceImpl")
    private KeService keService;
    @Autowired
    @Qualifier("classesServiceImpl")
    private ClassesService classesService;
    @Autowired
    @Qualifier("classKeServiceImpl")
    private ClassKeService classKeService;
    @RequestMapping("/classKeKID")
    private String classKeKID() throws JsonProcessingException {
        List<Ke> keList = keService.queryKe();
        ObjectMapper objectMapper = new ObjectMapper();
        String val = objectMapper.writeValueAsString(keList);
        return  val;
    }
    @RequestMapping("/queryClassesJ")
    private String queryClassesJ() throws JsonProcessingException {
        List<Classes> classesList = classesService.queryClasses();
        ObjectMapper objectMapper = new ObjectMapper();
        String val = objectMapper.writeValueAsString(classesList);
        return  val;

    }

}
